package edu.fafu.service.impl;

import javax.annotation.Resource;

import org.hibernate.Hibernate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import edu.fafu.dao.ILoginDao;
import edu.fafu.entity.Admin;
import edu.fafu.entity.User;
import edu.fafu.service.ILoginService;
import edu.fafu.util.HibernateSupport;
@Service("loginService")
public class LoginService implements ILoginService{
	@Resource(name="loginDao")
	private ILoginDao loginDao;

	@Override
	public Admin findById(int id) {
		return loginDao.findById(id);
	}
	@Transactional
	@Override
	public User findUser(User u) {
		User user = loginDao.findUser(u);
		return user;
	}
	@Transactional
	@Override
	public void addUser(User u) {
		loginDao.addUser(u);	
	}
	@Transactional
	@Override
	public void updatePassword(User user) {
		loginDao.updateUser(user);
	}
	
}
